package com.epam.utils;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import com.epam.entity.Car;

public class Main {

	EntityManagerFactory emf;
	EntityManager em;
	
	public static void main(String[] args) {
		
		System.out.println("bla-bla");
		Main main = new Main();
		
		main.dbWrite();

	}

	public void dbWrite(){
		emf = Persistence.createEntityManagerFactory("CarRent2");
		em = emf.createEntityManager();

		em.getTransaction().begin();
		Car car = new Car();
		car.setModel("BMW");
		em.persist(car);
		em.getTransaction().commit();
	}
	
}
